#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;

//#define READ_FILE

struct Mouse
{
	short weight;
	short speed;
	short oriIndex;
};
Mouse g_mice[1000];

struct DP
{
	int maxLen;
	int prevIndex;
};
DP g_dp[1000];

///////////////////////////////
// quick sort
///////////////////////////////
int partition(int beg, int end)
{
	int pivotIndex = 1.0 * rand() / RAND_MAX * (end - beg);
	swap(g_mice[beg], g_mice[beg + pivotIndex]);
	
	while (true)
	{
		while (beg < end && g_mice[end].weight > g_mice[beg].weight) { --end; }
		if (beg == end) { break; }
		
		if (g_mice[beg].weight != g_mice[end].weight) { swap(g_mice[beg], g_mice[end]); }
		++beg;
		
		while (beg < end && g_mice[beg].weight < g_mice[end].weight) { ++beg; }
		if (beg == end) { break; }
		
		if (g_mice[beg].weight != g_mice[end].weight) { swap(g_mice[beg], g_mice[end]); }
		--end;
	}
	
	return beg;
}

void quickSort(int beg, int end)
{
	if (beg < end)
	{
		int pivot = partition(beg, end);
		quickSort(beg, pivot-1);
		quickSort(pivot+1, end);
	}
}
//////////////////////////////////////

//////////////////////////////////////
// Dynamic programming
//////////////////////////////////////
int findSequence(int len)
{
	for (int i = 0; i < len; ++i)
	{
		g_dp[i].maxLen = 1;
		g_dp[i].prevIndex = -1;
	}
	
	int maxLen = 1;
	int maxIndex = 0;
	
	for (int i = 1; i < len; ++i)
	{
		for (int j = 0; j < i; ++j)
		{
			if (g_mice[j].weight < g_mice[i].weight && g_mice[j].speed > g_mice[i].speed)
			{
				if (g_dp[j].maxLen + 1 > g_dp[i].maxLen)
				{
					g_dp[i].maxLen = g_dp[j].maxLen + 1;
					g_dp[i].prevIndex = j;
				}
			}
		}
		
		if (g_dp[i].maxLen > maxLen)
		{
			maxLen = g_dp[i].maxLen;
			maxIndex = i;
		}
	}
	
	return maxIndex;
}
///////////////////////////////////////

void display(int index)
{
	vector<int> buf;
	while (index != -1)
	{
		buf.push_back(g_mice[index].oriIndex);
		index = g_dp[index].prevIndex;
	}
	
	cout << buf.size() << endl;
	for (int i = (int)buf.size()-1; i >= 0; --i)
	{
		cout << buf[i] << endl;
	}
}

int main()
{
#ifdef READ_FILE
	ifstream in("1108.input");
	if (!in) { in.open("../1108.input"); }
#else
	#define in cin
#endif

	srand((unsigned)time(NULL));
	
	int len = 0;
	while (in >> g_mice[len].weight >> g_mice[len].speed)
	{
		g_mice[len].oriIndex = len + 1;
		++len;
	}
	
	quickSort(0, len-1);
	int index = findSequence(len);
	display(index);
	
	return 0;
}